import request from '@/utils/request'
/**
 * 获取目录列表
 * ***/
export function getDirectoryslistApi(page, pagesize) {
  return request({
    url: `/directorys`,
    method: 'GET',
    params: {
      page,
      pagesize
    }
  })
}
/**
 * 搜索目录列表
 * @param {string}  directoryName 目录名称
 * @param {string} state 1开启 2关闭 是否开启
 * ***/
export function getSearchdApi(directoryName, state, subjectID) {
  return request({
    url: `/directorys`,
    method: 'GET',
    params: {
      directoryName,
      state,
      subjectID
    }
  })
}
export function getSearchdsApi(subjectID) {
  return request({
    url: `/directorys`,
    method: 'GET',
    params: {
      subjectID
    }
  })
}
// export function getSearchdsApi(directoryName) {
//     return request({
//         url: `/directorys`,
//         method: 'GET',
//         params: {
//             directoryName

//         }
//     })
// }
/**
 * 删除目录
 * @param {string}  id 当前目录的/subjects/simple
 * ***/
export function getDeldirectoryApi(id) {
  return request({
    url: `/directorys/${id}`,
    method: 'DElETE'
  })
}

/**
 * 获取学科简单列表
 * ***/
export function getsubjectsApi() {
  return request({
    url: `/subjects/simple`,
    method: 'GET'
  })
}
/**
 * 添加目录
 * @param {string}  id 当前目录的/subjects/simple
 * ***/
export function getAddirectoryApi(subjectID, directoryName) {
  return request({
    url: `/directorys`,
    method: 'POST',
    data: {
      subjectID,
      directoryName
    }
  })
}
/**
 * 修改目录
 * @param {string}  id 当前目录的/subjects/simple
 * ***/
export function getEditirectoryApi(data) {
  return request({
    url: `/directorys/${data.id}`,
    method: 'PUT',
    data
  })
}
/**
 * 获取目录详情
 * @param {string}  id 当前目录的/subjects/simple
 * ***/
export function getDeldirectorysApi(id) {
  return request({
    url: `/directorys/${id}`,
    method: 'GET'
  })
}
/**
 * 修改目录状态
 * @param {string}  id 当前目录的id
 * @param {string} state 启用还是关闭
 * ***/
export function getdirectorystateApi(row) {
  return request({
    url: `/directorys/${row.id}/${row.state}`,
    method: 'POST'
  })
}
